package service

import (
	erp "ez/apps/erp/document"
	"gitee.com/dreamwood/ez-go/ez"
	"gitee.com/dreamwood/ez-go/ss"
)

const (
	NeedStatus_Approval_Cancel  = "approval_cancel"
	NeedStatus_Approval_Confirm = "approval_confirm"
	NeedStatus_Approval_Start   = "approval_start"
)

func MustHaveNeedStep(step string) *erp.NeedStatus {
	crudStatus := erp.NewNeedStatusCrud()
	find, e := crudStatus.FindOneBy(ss.M{
		"step": step,
	}, nil)
	ez.Try(e)
	if find.Id == 0 {
		find.Name = step
		find.Step = step
		ez.Try(find.Save())
	}
	return find
}
